package com.download.web.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.download.web.entity.BusUserHistory;
import com.download.web.entity.model.ArticleListModel;
import com.download.web.entity.model.ArticleModel;
import com.download.web.entity.model.Page;
import com.download.web.mapper.BusUserHistoryMapper;
import com.download.web.service.IBusUserHistoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: cmy
 * @create: 2019-03-08 21:05
 **/
@Service
public class BusUserHistoryServiceImpl extends ServiceImpl<BusUserHistoryMapper, BusUserHistory> implements IBusUserHistoryService {

    @Resource
    private BusUserHistoryMapper userHistoryMapper;
    @Override
    public Page<ArticleListModel> articleHistoryList(Integer pageIndex, Integer pageSize, Integer userId){
        List<ArticleListModel> articleList=userHistoryMapper.userArticleByHistory(pageIndex,pageSize,userId);

        Integer size=userHistoryMapper.userArticleByHistoryCount(userId);
        return new Page<>(articleList,size,pageIndex,pageSize);
    }
}
